package net.oschina.archx.spring.taglib.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 * 实现一个当前日期的输出
 *
 * @author Archx[archx@foxmail.com]
 * @date 2016/3/11 0011
 */
public class CustomerJspTag extends SimpleTagSupport {

    private String pattern;

    @Override
    public void doTag() throws JspException, IOException {
        String current = new SimpleDateFormat(pattern).format(Calendar.getInstance().getTime());
        getJspContext().getOut().write(current);
    }

    public String getPattern() {
        return pattern;
    }

    public void setPattern(String pattern) {
        this.pattern = pattern;
    }
}
